package org.makcro.sms.services.chat.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * The persistent class for the Answer database table.
 * 
 */
@Entity
@NamedQueries({
	@NamedQuery(name = "Answer.findByCoreId", query = "SELECT a FROM Answer a WHERE a.coreID = :coreId")
})
@Table(name="answer")
public class Answer implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="AnswerID")
	private int answerID;

	@Column(name="Answer")
	private String answer;

	@Column(name="AnswerDelivered")
	private boolean answerDelivered;

	@Column(name="CoreID")
	private Long coreID;

	@Column(name="DateAnswered")
	@Temporal(TemporalType.TIMESTAMP)
	private Date dateAnswered;

	@Column(name="FromNumber")
	private String fromNumber;

	@Column(name="ToNumber")
	private String toNumber;

	@Column(name="Visable")
	private boolean visable;
	
	//bi-directional many-to-one association to Question
    @ManyToOne(cascade = CascadeType.PERSIST)
	@JoinColumn(name="QuestionID")
	private Question question;

    
    public Answer() {
    }

	public int getAnswerID() {
		return this.answerID;
	}

	public void setAnswerID(int answerID) {
		this.answerID = answerID;
	}

	public String getAnswer() {
		return this.answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public void setAnswerDelivered(boolean answerDelivered) {
		this.answerDelivered = answerDelivered;
	}
	
	public boolean isAnswerDelivered() {
		return answerDelivered;
	}

	public Long getCoreID() {
		return coreID;
	}
	
	public void setCoreID(Long coreID) {
		this.coreID = coreID;
	}

	public void setDateAnswered(Date dateAnswered) {
		this.dateAnswered = dateAnswered;
	}
	
	public Date getDateAnswered() {
		return dateAnswered;
	}

	public String getFromNumber() {
		return this.fromNumber;
	}

	public void setFromNumber(String fromNumber) {
		this.fromNumber = fromNumber;
	}

	public String getToNumber() {
		return this.toNumber;
	}

	public void setToNumber(String toNumber) {
		this.toNumber = toNumber;
	}

	public Question getQuestion() {
		return this.question;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}
	
	public boolean isVisable() {
		return visable;
	}
	
	public void setVisable(boolean visable) {
		this.visable = visable;
	}
	
}